import './index.less';

import React from 'react';

import sceneStore from '@/stores/scene';

const ModeButton = () => {
  const toggle = sceneStore(state => state.toggle);

  const onClickSwitch = () => {
    document.body.classList.toggle('light-mode');
    toggle();
  };

  return (
    <div className="dark-light" onClick={onClickSwitch}>
      <svg
        viewBox="0 0 24 24"
        stroke="currentColor"
        strokeWidth="1.5"
        fill="none"
        strokeLinecap="round"
        strokeLinejoin="round"
      >
        <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z" />
      </svg>
    </div>
  );
};

export default ModeButton;
